<template>
    <div class="child7">
        <button @click="sendMsg">点击触发父组件的自定义事件</button>
        <button @click="unbind">点击解绑父组件的自定义事件</button>
    </div>
</template>

<script>
export default {
    name: 'Child7',
    methods: {
        sendMsg() {
            this.$emit('show-msg');
        },
        unbind() {
            // 不带回调的写法
            this.$off('show-msg');
        }
    }
}
</script>

<style scoped>
button {
    margin-right: 5px;
}
</style>